import fetch from 'common/src/utils/fetch';
import { queryDic } from "common/src/api/dictionary";

const httpPost = (url, data, headers = {}) => {
  return fetch({
    url: url,
    method: 'post',
    header: Object.assign(headers, {
      'Content-Type': 'application/json'
    }),
    data
  });
};
const httpGet = (url) => {
  return fetch({
    url: url,
    method: 'get'
  });
};

const findCollege = (lang = 'cn') => {
  const params = {
    lang: lang,
    type: "allChild",
    keys: ["X_YX"]
  };
  return queryDic(params);
};

const findSex = (lang = 'cn') => {
  const params = {
    lang: lang,
    type: "allChild",
    keys: ["G_XBIE"]
  };
  return queryDic(params);
};

//查询专业
const getMajorList = (data) =>{
  return httpPost('/api/commonservice/campusProfession/findCampusProfessionList', data);
};

export const prefix = '/api/graduationservice';

export const http = {
  httpPost,
  httpGet
};

export const api = {
  findCollege,
  getMajorList,
  findSex
};

